﻿; - Sequentially specify actions to take on each event.
; - Format for commands is #Command:Argument (argument is only needed for 
;   commands that support arguments).  Commands and arguments are both Int32.
; - If you want to specify an alternate command if the first one is unable to
;   execute (for example, there is no pause on streams), then use a comma.
; - Conditional commands based on state or flag start with a ?.  Two states are
;   supported: Playback state (?PS) and current item type (?IT).  Currently
;   only = comparison is supported.  PS has states PLaying, PAused, and STopped.
;   IT has FIle, STream, and NOne.  Flags are F and then A-Z, such as FA, FB,
;   etc.  After condition test, a semicolon is used as a "then" qualifier.
; - Set flags as follows: ! then flag A-Z = and set to any int32 value.
; - Flag default value is always 0.
; - Invalid syntax is logged to error log and ignored, going to next command.
; - This simple scripting language is majorly sucky, so at some point it will
;   probably be replaced with something proper. :-)
; - Key_HEX for keyboard events on press of a key.  ActiveOnList specifies
;   whether the keystroke event is executed when on a list (as opposed to
;   initiating the list search/filter function).  This is useful when you want a
;   letter, number, or symbol to be a control when on a playing screen, but to
;   still filter a list when on a list.  Default is FALSE.


;;;;;;;;;;;;;;;;;;;
; Built-in events ;
;;;;;;;;;;;;;;;;;;;

[OnApplicationStart]

[OnApplicationExit]

[OnPhoneInUseStart]
; If playing, pause if possible, if not then stop.  Set flag A to 1 if previous
; playback state was 'playing.'
Action1 = !FA=0
Action2 = ?PS=PL;#3,1
Action3 = ?PS=PL;!FA=1

[OnPhoneInUseEnd]
; Play if previously paused/stopped.  We skip back because WM takes a few
; moments for the audio to switch from phone output back to standard output.
; This may be especially noticeable if switching from headphone output to
; bluetooth and back.
Action1 = ?FA=1;#7:3
Action2 = ?FA=1;#2
Action3 = !FA=0



;;;;;;;;;;;;;;;;;
; Custom events ;
;;;;;;;;;;;;;;;;;

[Key_25]
; D-Pad Left = Previous/Rewind
ActiveOnList = 1
Action1 = #5

[Key_27]
; D-Pad Right = Next/Forward
ActiveOnList = 1
Action1 = #6

[Key_26]
; D-Pad Up = List Up
ActiveOnList = 1
AllowRepeat = 1
Action1 = #201

[Key_28]
; D-Pad Up = List Down
ActiveOnList = 1
AllowRepeat = 1
Action1 = #202

[Key_29]
; D-Pad Select/Action = Select (when on a list) or Stop/Play/Pause multibutton
; depending on playback state.
ActiveOnList = 1
Action1 = #402

[Key_D]
; Enter = Select (when on a list) or Stop/Play/Pause multibutton depending on
; playback state.
ActiveOnList = 1
Action1 = #402
